<?
layout("/inc/layout.html",{title:sysTitle}){
?>

<div id="page-wrapper">
      <!--BEGIN TITLE & BREADCRUMB PAGE-->
      <div id="title-breadcrumb-option-demo" class="page-title-breadcrumb">
          <div class="page-header pull-left">
              <div class="page-title">数据集注册</div>
          </div>
          <ol class="breadcrumb page-breadcrumb pull-left">
              <li><i class="fa fa-home"></i>&nbsp;<a href="main.html">首页</a>&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
              <li>数据集注册&nbsp;&nbsp;&nbsp;&nbsp;</li>
              
          </ol>
           
          <div class="clearfix"></div>
      </div>
      <!--END TITLE & BREADCRUMB PAGE-->
      <!--BEGIN CONTENT-->
      <div class="page-content">
      
      
      <div class="row mbl">
           <div class="col-lg-6">
               <div class="input-group input-group-sm mbs"><span class="input-group-btn">
               	<select id="queryParams" class="btn btn-danger dropdown-toggle" style="width :100px;">
               		<option value="-1">筛选项&nbsp;<span class="caret"></span></option>
                    <option value="datasetName">数据集名称</option>
                    <option value="categoryName">类别名称</option>
                    </select>
                   </span>
                   <input type="text" id="text" placeholder="请输入关键词..." class="form-control" /><span class="input-group-btn"><button type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle" onclick="get()">搜索</button></span>
               </div>
           </div>
           <div class="col-lg-6">
               <div class="tb-group-actions pull-right"><span>当前共<label id="pageSize"></label>条记录:</span>
                   <select id="pageNumber" class="table-group-action-input form-control input-inline input-small input-sm mlm" onchange="get()">
                       <option value="5">5</option>
                       <option value="10" >10</option>
                       <option value="15" selected>15</option>
                       <option value="25">25</option>
                       <option value="50">50</option>
                   </select>&nbsp;
                   <button class="btn btn-sm btn-primary" onclick="kk('0')">新增
                   </button>
               </div>
           </div>
       </div>
      
      <table class="table table-hover table-striped table-bordered table-advanced tablesorter mbn">
            <thead>
                <tr>
                  
                   <th  style="text-align:center;">序号</th>
                    <th>数据集标识</th>
                    <th >数据集名称</th> 
                    <th >部门名称</th>                 
                    <th >数据集数量</th>
                      
                    <th >类别名称</th>
                    <th >类别编码</th>
                    <th>语种</th>
                    <th >关键词</th>
                    <th >负责人姓名</th>
                    <th >负责单位名称</th>
                     <th >可操作</th>
                </tr>
            </thead>
             <tbody id="newspaperls"></tbody>
        </table>
<div id="dataNull" class="panel-body"
				style="height: 90px; line-height: 50px;" align="center">
				<span class='subtitle' style="font-size: 15px;">数据为空!</span>
		</div>
        <div id="page1" style="text-align: center; margin-top: 20px;"></div>
    </div>
                     
    <!--END CONTENT-->
    </div>
    
  <script>
   var curr;var id;
$(function(){
	list1();
});
function get() {  
          	list1(curr);
    }
function getlay( ) {  
            return id;
    }
			function kk(lid) {
				id = lid;
				layer.open({
					type : 2,
					area : [ '1050px', '630px' ],
					title:"数据集注册或编辑",
					fix : false, //不固定
					scrollbar : false,
					shadeClose : true,
					move : false,
					skin : 'layui-layer-rim', //加上边框
					btn : [ '保存 ', '关闭' ],
					content : "knowledge-data-Register-from.html",
					yes: function(index,layer){
    	                  var iframeWin = parent.window[layer.find('iframe')[0]['name']];
    	                   iframeWin.Page();
    	              },
					cancel : function(index) {
					}
				});
			 }
			function del(id) {

				if (confirm("是否确认删除！！")) {
					$.ajax({
								type : "post",
								url : "./KnowledgeDataRegisterdel.do",
								data : {
									"id" : id
								},
								dataType : "json",
								success : function(data) {
									layer.alert("删除成功");
									list1(curr);
								},
								error : function(data) {
									alert("请求失败");
								}
							});
				}

			}
			function list1(curr) {
				$.getJSON("./KnowledgeDataRegisterList.do",
								{
									page : curr || 1,
									queryParams : $("#queryParams").val(),
									text : $("#text").val(),
									pageNumber : $("#pageNumber").val()
								},
								function(res) {
									//此处仅仅是为了演示变化的内容
									var str = "";
             if(res.listsize>0){
					$("#dataNull").hide();
				}else{
					$("#dataNull").show();
				}
									$("#newspaperls").html("")
									for ( var i = 0; i < res.listsize; i++) {
										var username;
										if (res.result[i].createUser == null) {
											username = " ";
										} else {
										
											username = res.result[i].createUser.name;
										}
										str += "<tr><td align=\"center\"> "
												+ (i + 1)
												+ "</td><td> <label >"
												+ res.result[i].doi
												+ "</label></td><td><label >"
												+ res.result[i].datasetName
												+ "</label></td><td><label >"
												+ username	
												+ "</label></td><td><label >"
												+ res.result[i].recordNum
												+ "</label></td><td><label >"
												+ res.result[i].categoryName
												+ "</label></td><td><label >"
												+ res.result[i].categoryCode
												+ "</label></td><td><label >"
												+ res.result[i].language
												+ "</label></td><td><label >"
												+ res.result[i].keywords
												+ "</label></td><td><label >"
												+ res.result[i].individualName
												+ "</label></td><td><label >"
												+ res.result[i].organizationName
													
												+ "</label></td><td>"
												+ "<button type=\"button\" class=\"btn btn-default btn-xs\"onclick=\"del('"
												+ res.result[i].id
												+ "')\">"
												+ "删除"
												+ "</button>"
												+ "          <button type=\"button\" class=\"btn btn-default btn-xs\"  onclick=\"kk('"
												+ res.result[i].id
												+ "')\">"
												+ "编辑"
												+ "</button>"
												+ "</td></tr>";
									}
									$("#newspaperls").append(str);
  document.getElementById('pageSize').innerHTML=res.listsize;
									laypage({
										cont : document.getElementById('page1'), //容器。值支持id名、原生dom对象，jquery对象,
										pages : res.pageSize, //总页数
										skip : true, //是否开启跳页
										skin : 'molv', //加载内置皮肤，也可以直接赋值16进制颜色值，如:#c00
										curr : curr || 1,
										last: res.pageSize,
										groups : 6,//连续显示分页数
										jump : function(obj, first) { //触发分页后的回调
											if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
												list1(obj.curr);
												var curr = obj.curr;
												curr = obj.curr;
											}
										}
									});
								});
			};
		</script>
<?} ?>

